# Make new targets for testing. Currently, I only need one to copy resource files
# and execute carblogger_ui
# Maybe ctest would be a good idea but for now, one custom target will do.

MESSAGE("\n+++ Started: DefineTests +++") 

SET(config_file ${CMAKE_SOURCE_DIR}/ancillary/install-base/etc/carblogger_ui-config.xml)
SET(resource_files ${CMAKE_SOURCE_DIR}/ancillary/install-base/usr/lib/carblogger_ui)

ADD_CUSTOM_TARGET(testrun 
    DEPENDS carblogger_ui
    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
    COMMAND ${CMAKE_COMMAND} -E copy ${config_file} .
    COMMAND ${CMAKE_COMMAND} -E copy_directory ${resource_files} .
    # Notice that docroot is overridable. If you do that, then you need to specify --config (not enough time to make it work another way)
    COMMAND ./carblogger_ui --http-address `hostname  -I | cut -f1 -d' '` --http-port 9090  --docroot . --config carblogger_ui-config.xml)
